import { BaseService } from '../base.service'
import {getVerifyId} from "../auth/auth.service";
import Wrapper from "../util";
let verify_id = '?verify_id=' + getVerifyId();
const wrapper = new Wrapper;

export class SpotifyService extends BaseService {
  static get entity () {
    return 'spotify'
  }

  static getList(parameters = {}, isShowNotification = true) {
    const params = {
      ...parameters,
    }
    verify_id = '?verify_id=' + getVerifyId();
    return new Promise((resolve, reject) => {
      return this.request({auth: true}).get(`${this.entity}/getList${verify_id}`, {params}).then(response => {
        wrapper.setWrapper(response, isShowNotification).then(() => {
          return resolve(response.data)
        }).catch(() => {
          return reject(response.data)
        })
      }).catch(error => {
        reject(console.log('getList ' + this.entity, error))
      })
    })
  }
}
